package org.sems.sems.Controller;

import org.sems.sems.Public.PublicService;
import org.sems.sems.service.DataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/data")
public class DataController {
    @Autowired
    private DataService dataService;
    @Autowired
    private PublicService publicService;

    @RequestMapping(value = "/getAllJCSJ1", method = RequestMethod.GET)
    public Map<String, Object> getAllJCSJ() {
        return dataService.get_JCSJ1();
    }

    @GetMapping(value = "/getAllJCSJ2")
    public Map<String, Object> getAllJCSJ2() {
        return dataService.get_JCSJ2();
    }

    // 获取学生管理所需数据：班级代码库、学历天梯库、专业代码库
    @GetMapping("/getAllStuGLData")
    public Map<String, Object> getAllStuGLData() {
        return dataService.get_XSGLDATA();

    }

    // 获取学生中文和数据库中英文对照
    @GetMapping("/getStuDYMap")
    public Map<String, Object> getAllStuDYMap() {
        // 对应的数据
        Map<String, Object> DYSJ = new HashMap<>();
        DYSJ.put("data", publicService.readJSONFile("dataJson.json").get("STUDYDATA"));
        DYSJ.put("code", 200);
        DYSJ.put("msg", "OK");
        DYSJ.put("result", true);
        return DYSJ;
    }

    // 获取系统数据显示
    @GetMapping("/getSystemDataCount")
    public Map<String, Object> getSystemDataCount(String YHM, int YHSFDM) {
      return publicService.getSystemDataCount(YHM, YHSFDM);
    }


    // 获取用户首页数据
    @GetMapping("/getUserIndexCount")
    public Map<String, Object> getUserIndexCount(String YHM, int YHSFDM) {
        return publicService.getUserIndexCount(YHM, YHSFDM);
    }

    @GetMapping("/getTdtjData")
    public Map<String, Object> getTdtjData(String YHM, int YHSFDM,int JsSeven) {
        return publicService.getTdjlkTjdata(YHM, YHSFDM,JsSeven);
    }

    // 教师获取待办事项
    @GetMapping("/getWaitTodoData")
    public Map<String, Object> getTodoData(String YHM) {
       return publicService.getWaitTodoData(YHM);
    }

    // 获取岗位投递次数统计
    @GetMapping("/getGwtjcsData")
    public Map<String, Object> getGwtjcsData(String YHM,int YHSFDM) {
        return publicService.getGwtjcsData(YHM,YHSFDM);
    }

    // 微信小程序获取学生基础就业信息
    @GetMapping("/getStuJbZyData")
    public Map<String, Object> getStuJbZyData(String YHM) {
        return publicService.getStuJbZyData(YHM);
    }


    // 统计：管理员首页专业人数统计
    @GetMapping("/getAdminIndexZYTJData")
    public Map<String, Object> getAdminIndexZYTJData() {
        return publicService.getAdminIndexZYTJData( );
    }
    // 统计：管理员首页单位行业数量
    @GetMapping("/getAdminIndexDwhyTJData")
    public Map<String, Object> getAdminIndexDwhyTJData() {
        return publicService.getAdminIndexDwhyTJData();
    }

    // 统计：管理员首面试的趋势、男女碧梨
    @GetMapping("/getAdminIndexStuMsData")
    public Map<String, Object> getAdminIndexStuMsData() {
        return publicService.getAdminIndexStuMsData();
    }
}
